package web;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import beans.PersonInformation;
import serviceimpl.SearchByUsernameServiceIpmt;
@WebServlet("/SearchByUsernameServlet2")
public class SearchByUsernameServlet2 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		SearchByUsernameServiceIpmt ipmt = new SearchByUsernameServiceIpmt();
		String username=request.getParameter("text");
		List<PersonInformation> list = ipmt.searchByUsernameService(username);
		HttpSession session = request.getSession();
		session.setAttribute("persons", list);
		response.sendRedirect("/zzLoveProduct/search/SearchById.jsp");
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
}
